﻿namespace Mediator
{
    internal class ColleagueCheckbox : RadioButton, IColleague
    {
        private IMediator mediator;
        public ColleagueCheckbox(string caption, bool state)
        {
            this.Text = caption;
            this.Checked = state;
        }

        public void SetColleagueEnabled(bool enabled)
        {
            this.Enabled = enabled;
        }

        public void SetMediator(IMediator mediator)
        {
            this.mediator = mediator;
        }

        protected override void OnCheckedChanged(EventArgs e)
        {
            mediator.ColleagueChanged();
            base.OnCheckedChanged(e);
        }
    }
}
